﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using com.vs.General;
using com.vs.DataAccess;
using com.vs.DataAccess.DO;
using com.vs.General.RF;

namespace com.vs.RF.Web.inventory
{
    public partial class LocationInquiryResult : RFDisplayPage
    {
        private List<LocationInventoryDO> ltInv = null;
        protected int iIndex = 0;
        protected LocationInventoryDO liDO = null;
        protected bool bAtBeginning = false;
        protected bool bAtEnd = false;
        protected int iTotal = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            /*
            if (Session["LOCATION_INQ_ITEM_RESULT_PAGE"] == null)
            {
                DataTable dt = (DataTable)Session["LOCATION_INQ_ITEM_RESULT"];
                itemDO.Item = dt.Rows[0]["ITEM"];
                itemDO.ITEM_DESC = dt.Rows[0]["ITEM_DESC"];
                itemDO.LPN = dt.Rows[0]["LPN"];
                itemDO.Locatiom = dt.Rows[0]["Locatiom"];
            }
            else
            {
                DataRow dr = (DataRow)Session["LOCATION_INQ_ITEM_RESULT_PAGE"];
                itemDO.Item = dr["ITEM"];
                itemDO.ITEM_DESC = dr["ITEM_DESC"];
                itemDO.LPN = dr["LPN"];
                itemDO.Locatiom = dr["Locatiom"];
            }
            */
            go();
        }

        protected override void initData()
        {
            ltInv = (List<LocationInventoryDO>) Session["INV_INQUIRY_RESULT"];
            if (ltInv == null || ltInv.Count < 1)
            {
                this.stErrorMessage = MessageManager.MSG_INV_001; //未找到库存
                return;
            }

            iTotal = ltInv.Count;

            if (iIndex >= ltInv.Count)
            {
                iIndex = ltInv.Count - 1;
                bAtEnd = true;
            }
            else if (iIndex < 1)
            {
                bAtBeginning = true;
            }

            liDO = ltInv[iIndex];
        }

        protected override void parseRequest()
        {
            if (Session["INV_RESULT_INDEX"] != null)
                iIndex = (int)Session["INV_RESULT_INDEX"];
            else
            {
                Session["INV_RESULT_INDEX"] = 0;
            }
        }
    }
}
